package com.cy.aircompressor.api;

import com.cy.aircompressor.entity.compressor.Compressor;
import com.cy.aircompressor.entity.system.SysConfig;
import com.cy.aircompressor.entity.system.UserInfo;
import com.drug.lib.view.recycptr.bean.RowEntity;
import com.net.model.bean.BaseResponse;

import java.util.Map;

import io.reactivex.Flowable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface UserApi {

    /**
     * 登录
     *
     * @param body 请求数据map
     * @return Flowable
     */
    @POST("login")
    @Headers({"Content-Type:application/json;charset=UTF-8"})
    Flowable<BaseResponse<String>> login(@Body Map<String, Object> body);
    /**
     * 登录
     *
     * @return Flowable
     */
    @POST("logout")
    Flowable<BaseResponse<Object>> logout();

    /**
     * 获取当前登录用户信息
     *
     * @return Flowable
     */
    @GET("user/currentUserInfo")
    Flowable<BaseResponse<UserInfo>> currentUserInfo();


    /**
     * 查询配置
     *
     * @return Flowable
     */
    @GET("sysConfig/queryConfig")
    Flowable<BaseResponse<SysConfig>> queryConfig();


    /**
     * 新增用户
     *
     * @param parameters
     * @return
     */
    @POST("user/add")
    Flowable<BaseResponse<Object>> addUser(@Body Object parameters);

    /**
     * 根据id删除用户信息
     *
     * @return Flowable
     */
    @POST("user/deleteByIds")
    Flowable<BaseResponse<Object>> deleteByIds(@Body String[] ids);

    /**
     * 修改用户
     *
     * @param parameters
     * @return
     */
    @POST("user/update")
    Flowable<BaseResponse<Object>> updateUser(@Body Object parameters);

    /**
     * 修改密码
     *
     * @param parameters
     * @return
     */
    @POST("user/updatePwd")
    Flowable<BaseResponse<Object>> updatePwd(@Body Object parameters);

    /**
     * 分页查询用户
     *
     * @param pageNum
     * @param pageSize
     * @param account
     * @param name
     * @param powerStationId
     * @return
     */
    @GET("user/queryPage")
    Flowable<BaseResponse<RowEntity<UserInfo>>> getUserByPage(@Query("pageNum") Integer pageNum, @Query("pageSize") Integer pageSize,
                                                              @Query("account") String account, @Query("name") String name, @Query("powerStationId") String powerStationId);

    /**
     * 根据id查询用户信息
     *
     * @return Flowable
     */
    @GET("user/queryById")
    Flowable<BaseResponse<UserInfo>> queryById(@Query("id ") String id);


}
